using Firestarter.DB.Schema.BO;

namespace FireStarterModeller.Test
{
    public partial class TestUtilsDatabaseConnectionInfo
    {
        /// <summary>
        /// Creates a new saved DatabaseConnectionInfo with a random value assigned to every property
        /// </summary>
        public static DatabaseConnectionInfo CreateSavedDatabaseConnectionInfo()
        {
            DatabaseConnectionInfo databaseConnectionInfo = CreateUnsavedValidDatabaseConnectionInfo();
            databaseConnectionInfo.Save();
            return databaseConnectionInfo;
        }

        /// <summary>
        /// Creates a new unsaved DatabaseConnectionInfo with a random value assigned to every property
        /// </summary>
        public static DatabaseConnectionInfo CreateUnsavedValidDatabaseConnectionInfo()
        {
            DatabaseConnectionInfo databaseConnectionInfo = new DatabaseConnectionInfo();
            databaseConnectionInfo.Vendor = TestUtilsShared.GetRandomString();
            databaseConnectionInfo.Server = TestUtilsShared.GetRandomString();
            databaseConnectionInfo.Port = TestUtilsShared.GetRandomString();
            databaseConnectionInfo.Database = TestUtilsShared.GetRandomString();
            databaseConnectionInfo.UserName = TestUtilsShared.GetRandomString();
            databaseConnectionInfo.Password = TestUtilsShared.GetRandomString();
            return databaseConnectionInfo;
        }
	    
        /// <summary>
        /// Creates a new unsaved DatabaseConnectionInfo where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DatabaseConnectionInfo CreateUnsavedDefaultDatabaseConnectionInfo()
        {
            DatabaseConnectionInfo databaseConnectionInfo = new DatabaseConnectionInfo();
            return databaseConnectionInfo;
        }
    }
}